package com.itheima.tcp.socket.socketDemo1;

import java.io.*;
import java.net.Socket;

public class ClientDemo1 {
    public static void main(String[] args) throws IOException {
        //创建客户端socket
        //Socket socket = new Socket("192.168.13.65",10086);
        Socket socket = new Socket("127.0.0.1",10086);

        //通过socket对象获取输出流，基于流往外写数据
        OutputStream os = socket.getOutputStream();
        os.write("(￣┰￣*)嗨，你好".getBytes());

        //关流，释放资源
        os.close(); //  底层会自动往外写一个结束标记
        socket.close();
    }
}
